<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>修改门店信息</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="/../../bangnuo/admin/layui/css/layui.css" media="all">
	</head>

	<body>

		<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
			<div class="layui-form-item">
				<label class="layui-form-label">编号</label>
				<div class="layui-input-inline">
					<input type="text" id="merchantsNumber" name="merchantsNumber"  placeholder="请输入用户编号" autocomplete="off" class="layui-input" readonly="readonly">
					<a style="color: red;">用户编号不可修改</a>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">地址</label>
				<div class="layui-input-inline">
					<input type="hidden" id="merchantsUuid" name="merchantsUuid" lay-verify="required" placeholder="请输入真实姓名" autocomplete="off" class="layui-input">
					<input type="text" id="merchantsAddress" name="merchantsAddress" lay-verify="required" placeholder="请输入真实姓名" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">门店名称</label>
				<div class="layui-input-inline">
					<input type="text" id="merchantsName" name="merchantsName" lay-verify="name" placeholder="请输入号码" autocomplete="off" class="layui-input">
				</div>
			</div>
			<!--<div class="layui-form-item">
				<label class="layui-form-label">创建时间</label>
				<div class="layui-input-inline">
					<input type="text" id="merchantsCreateTime" name="merchantsCreateTime" placeholder="请输入创建时间" autocomplete="off" class="layui-input">
				</div>
			</div>-->
			<div class="layui-form-item" lay-filter="sex">
				<label class="layui-form-label">账号状态</label>
				<div class="layui-input-block" id="merchantsStatus">
					<input  type="radio" name="merchantsStatus" value="0" title="正常">
					<input  type="radio" name="merchantsStatus" value="1" title="锁定">
				</div>
			</div>
			<div class="layui-btn-container" style="padding-bottom: 10px; margin-left: 110px; margin-right: -110px;">
				<button class="layui-btn" lay-submit lay-filter="admin-form" data-type="close">立即提交</button>
			</div>
		</div>
		<script src="../../bangnuo/admin/layui/layui.js"></script>
		<script src="../../bangnuo/admin/js/jquery-1.8.0.min.js"></script>
		<script>
			/*layui.use(['form', 'upload', 'layer'], function() {

				var form = layui.form;

				var resultData;
				var htmls = '<option value="">请选择</option>'; //全局变量

				//检查项目添加到下拉框中
				$.ajax({
					url: '/merchantsEntity/merchants',
					dataType: 'json',
					type: 'get',
					success: function(data) {
						resultData = data.queryResult.list;                       
						for(var x in resultData) {                            
							htmls += '<option value = "' + resultData[x].id + '">' + resultData[x].name + '</option>';                      
						} 
						$("#adminIdAgentId").html(htmls);
						form.render('select');
						//重新渲染 固定写法
					}
				})
			});*/
		</script>
		<script type="text/javascript">
            layui.use(['form', 'upload', 'layer'], function() {

                var form = layui.form;
                $(function () {
                    //获取地址栏路径
                    var url = window.location.href;
                    //获取“=”的下标
                    var pos = url.indexOf("=");
                    //获取“=”后的全部字符（用户id）
                    var id = url.substring(pos + 1, url.length);
                    $.ajax({
                        url: "/merchantsEntity/findById/" + id,
                        contentType: "application/json;charset=UTF-8",
                        type: "GET",
                        success: function (data) {
                            $("#merchantsNumber").val(data.queryResult.list[0].merchantsNumber);
                            $("#merchantsUuid").val(data.queryResult.list[0].merchantsUuid);
                            $("#merchantsAddress").val(data.queryResult.list[0].merchantsAddress);
                            $("#merchantsName").val(data.queryResult.list[0].merchantsName);
                            $("#merchantsCreateTime").val(data.queryResult.list[0].merchantsCreateTime);
                            // $("#merchantsStatus").val(data.queryResult.list[0].merchantsStatus);
                            $("input[name=merchantsStatus][value='0']").attr("checked", data.queryResult.list[0].merchantsStatus == '0' ? true : false);
                            $("input[name=merchantsStatus][value='1']").attr("checked", data.queryResult.list[0].merchantsStatus == '1' ? true : false);
                            form.render(); //更新全部
             /*               $("input[name=adminSex][value='男']").attr("checked", data.queryResult.list[0].adminSex == '男' ? true : false);
                            $("input[name=adminSex][value='女']").attr("checked", data.queryResult.list[0].adminSex == '女' ? true : false);
                            form.render(); //更新全部*/
                        }
                    });
                });
            })
		</script>
		<!--加载表单组件样式-->
		<script>
			layui.config({
				base: '../../bangnuo/admin/' //静态资源所在路径
			}).extend({
				index: 'lib/index' //主入口模块
			}).use(['index', 'form', 'upload'], function() {
				var $ = layui.$,
					form = layui.form,
					upload = layui.upload;

				upload.render({
					elem: '#layuiadmin-upload-useradmin',
					url: layui.setter.base + 'json/upload/demo.js',
					accept: 'images',
					method: 'get',
					acceptMime: 'image/*',
					done: function(res) {
						$(this.item).prev("div").children("input").val(res.data.src)
					}
				});
			})
		</script>
		<!--获取表单信息，提交表单-->
		<script type="text/javascript">
			layui.use(['form', 'layer'], function() {
				var $ = layui.$,
					form = layui.form,
					layer = layui.layer,
					index = parent.layer.getFrameIndex(window.name); //监听提交
				form.on('submit(admin-form)', function(data) {
					layer.msg(JSON.stringify(data.field));
					$.ajax({
						type: "POST",
						url: "/merchantsEntity/upMerchants",
						contentType: "application/json;charset=UTF-8",
						data: JSON.stringify(data.field),
						async: true,
						success: function(data) {
							if(data.success == true) {
							    var index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
							} else {
								layer.msg(data.message);
							}
						}
					});
					return false;
				});
				function cole(){
					var active = {
						close: function() {
							parent.layer.msg('修改成功');
							window.parent.location.reload();
							parent.layer.close(index);
						}
					}
					$('.layui-btn-container .layui-btn').on('click', function() {
						var othis = $(this),
							type = othis.data('type');
						active[type] && active[type].call(this);
					});
				}
			});
		</script>
	</body>

</html>